3D Graphics Programming with QuickDraw 3D 1.5.4
Previous | QD3D Book | Overview | Chapter Contents | Next |
A light object (or, more briefly, a light ) is a type of QuickDraw 3D object that you can use to provide illumination to the surfaces in a scene. A light is of type TQ3LightObject .
In general, the illumination of a surface in a scene is affected by multiple light sources. As a result, a view is associated with a light group, which is simply a group of lights. To illuminate the objects in the scene, you need to create a light group and attach it to a view (for example, by calling Q3LightGroup_New and Q3View_SetLightGroup ).
If you do not attach a group of lights to a view, the results are renderer-specific.
QuickDraw 3D supports multiple light sources and multiple types of lights in a given scene. QuickDraw 3D defines four types of lights:
All four types of lights share some basic properties, which are maintained in a light data structure, defined by the TQ3LightData data structure.
typedef struct TQ3LightData {
TQ3Boolean isOn;
float brightness;
TQ3ColorRGB color;
} TQ3LightData;
These fields specify the brightness (that is, the intensity) and color of the light and the current state (active or inactive) of the light. You can turn a light on and off by toggling the isOn field of a light data structure.
As you will see, an ambient light is completely described by a light data structure. All other types of lights contain additional information, such as the location and direction of the light source. Those kinds of lights are defined by data structures that include a light data structure.
Previous | QD3D Book | Overview | Chapter Contents | Next |